1 /*******************************************************************************
2  * Copyright (c) 2000, 2008 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.swt.custom;
15 
16 /**
17  * Use StyledTextPrintOptions to specify printing options for the
18  * StyledText.print(Printer, StyledTextPrintOptions) API.
19  * <p>
20  * The following example prints a right aligned page number in the footer,
21  * sets the job name to "Example" and prints line background colors but no other
22  * formatting:
23  * </p>
24  * <pre>
25  * StyledTextPrintOptions options = new StyledTextPrintOptions();
26  * options.footer = "\t\t&lt;page&gt;";
27  * options.jobName = "Example";
28  * options.printLineBackground = true;
29  *
30  * Runnable runnable = styledText.print(new Printer(), options);
31  * runnable.run();
32  * </pre>
33  *
34  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
35  *
36  * @since 2.1
37  */
38 public class StyledTextPrintOptions {
39 	/**
40 	 * Page number placeholder constant for use in <code>header</code>
41 	 * and <code>footer</code>. Value is <code>&lt;page&gt;</code>
42 	 */
43 	public static final String PAGE_TAG = "<page>";
44 	/**
45 	 * Separator constant for use in <code>header</code> and
46 	 * <code>footer</code>. Value is <code>\t</code>
47 	 */
48 	public static final String SEPARATOR = "\t";
49 	/**
50 	 * Formatted text to print in the header of each page.
51 	 * <p>"left '\t' center '\t' right"</p>
52 	 * <p>left, center, right = &lt;page&gt; | #CDATA</p>
53 	 * <p>Header and footer are defined as three separate regions for arbitrary
54 	 * text or the page number placeholder &lt;page&gt;
55 	 * (<code>StyledTextPrintOptions.PAGE_TAG</code>). The three regions are
56 	 * left aligned, centered and right aligned. They are separated by a tab
57 	 * character (<code>StyledTextPrintOptions.SEPARATOR</code>).
58 	 */
59 	public String header = null;
60 	/**
61 	 * Formatted text to print in the footer of each page.
62 	 * <p>"left '\t' center '\t' right"</p>
63 	 * <p>left, center, right = &lt;page&gt; | #CDATA</p>
64 	 * <p>Header and footer are defined as three separate regions for arbitrary
65 	 * text or the page number placeholder &lt;page&gt;
66 	 * (<code>StyledTextPrintOptions.PAGE_TAG</code>). The three regions are
67 	 * left aligned, centered and right aligned. They are separated by a tab
68 	 * character (<code>StyledTextPrintOptions.SEPARATOR</code>).
69 	 */
70 	public String footer = null;
71 	/**
72 	 * Name of the print job.
73 	 */
74 	public String jobName = null;
75 
76 	/**
77 	 * Print the text foreground color. Default value is <code>false</code>.
78 	 */
79 	public boolean printTextForeground = false;
80 	/**
81 	 * Print the text background color. Default value is <code>false</code>.
82 	 */
83 	public boolean printTextBackground = false;
84 	/**
85 	 * Print the font styles. Default value is <code>false</code>.
86 	 */
87 	public boolean printTextFontStyle = false;
88 	/**
89 	 * Print the line background color. Default value is <code>false</code>.
90 	 */
91 	public boolean printLineBackground = false;
92 
93 	/**
94 	 * Print line numbers. Default value is <code>false</code>.
95 	 *
96 	 * @since 3.3
97 	 */
98 	public boolean printLineNumbers = false;
99 
100 	/**
101 	 * Labels used for printing line numbers.
102 	 *
103 	 * @since 3.4
104 	 */
105 	public String[] lineLabels = null;
106 
107 }
108